function [breath, flow]=calculate_volume_flow_fit_LongBreath_toolbox(breath, scan_rate)

flow=NaN(size(breath));

breath_smoothed =smooth(breath,45);%sgolayfilt(bellows_volt(:,i),7,15); 


   for j=2:size(breath_smoothed,1)-1
       if (breath_smoothed(j+1)-breath_smoothed(j))~=0
           flow(j)=(breath_smoothed(j+1)-breath_smoothed(j))/scan_rate;
       else
           flow(j)=flow(j-1);
       end
    end
    
flow=smooth(flow,45);



